'use strict'

const {httpcli} = require('gohttp')
const wxkey = require('../config/wxkey')

let openid_url = `https://api.weixin.qq.com/sns/jscode2session`
        + `?appid=${wxkey.appid}`
        + `&secret=${wxkey.secret}`
        + `&grant_type=authorization_code`
        + `&js_code=`

module.exports = function(code) {
  return httpcli.get(openid_url+code)
}
